package com.a.learning_keep.frag

import android.content.Intent
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import com.a.learning_keep.activity.info.PersonalInformationActivity
import com.a.learning_keep.activity.set.SetingsActivity
import com.a.learning_keep.activity.time.TimerControlActivity
import com.a.learning_keep.databinding.Fragment1Binding
import com.a.learning_keep.util.showCustomDialog

class Fragment1Home : Fragment() {

    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
        val binding = Fragment1Binding.inflate(inflater, container, false)
        var context = requireActivity()

        /** 获取金币数量显示 **/
        binding.moneyText.text.apply {
            ////网络请求显示金币
        }

        /** 主页正中间 时钟表 （时间调节界面）**/
        binding.apply {
            mianTime.setOnClickListener {
                startActivity(
                    Intent(context, TimerControlActivity::class.java)
                )
            }
            mainImg.setOnClickListener {
                startActivity(
                    Intent(context, TimerControlActivity::class.java)
                )
            }
        }


        /** 跳转到 个人中心 界面 **/
        binding.loginBut.setOnClickListener {
            startActivity(
                Intent(context, PersonalInformationActivity::class.java)
            )
        }

        /** 跳转到 时间金币 界面 **/
        binding.moneyBut.setOnClickListener {
//            startActivity(
//                Intent(context, ::class.java)
//            )
        }

        /** 签到 **/
        binding.signInBut.setOnClickListener {
            showCustomDialog(context, "恭喜您 签到成功！") {
                //网络请求调用金币+1
            }
        }

        /** 跳转 设置 **/
        binding.setingBut.setOnClickListener {
            startActivity(
                Intent(context, SetingsActivity::class.java)
            )
        }





        return binding.root
    }
}